package com.mtsmda.jpa.run;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

import com.mtsmda.jpa.domain.joinedTable.Notebook;
import com.mtsmda.jpa.domain.joinedTable.PC;
public class ComputerServiceRun {

	public static void main(String[] args) {
		EntityManager entityManager = Persistence.createEntityManagerFactory(
				"MTSMDA").createEntityManager();
		entityManager.getTransaction().begin();

		PC pc1 = new PC(500, 4, true, "Asus");
		PC pc2 = new PC(1000, 8, false, "Galaxy");
		
		Notebook notebook1 = new Notebook(500, 2, 13.3);
		Notebook notebook2 = new Notebook(1000, 8, 15.6);

		entityManager.persist(pc1);
		entityManager.persist(pc2);
		entityManager.persist(notebook1);
		entityManager.persist(notebook2);

		entityManager.getTransaction().commit();
		entityManager.close();
	}

}